package edu.wust;


public class No1exam4 {

    public static boolean huiwen(long x) {
        long temp = x, ans = 0;
        while (temp != 0) {
            ans = ans * 10 + temp % 10;
            temp /= 10;
        }
        if(ans==x)return true;
        return false;
    }

    public static void main(String[] args){
        long max=0;
        for(long i=100;i<1000;i++){
            for(long j=100;j<1000;j++){
                long mul=i*j;
                if(huiwen(mul))
                    max=Math.max(max,mul);
            }
        }
        System.out.println(max);
    }
}
